//每次请求设置一个请求中间件判断前端是否携带token
async function verifyUser(ctx, next) {
  if (ctx.headers.authorization) {
    await next();
  } else {
    ctx.status = 402;
    ctx.body = {
      state: "error",
      message: "用户没有登录凭证",
    };
  }
}

module.exports = {
  verifyUser,
};
